package com.google.enterprise.mailmigration;

import com.google.gdata.data.appsforyourdomain.AppsForYourDomainException;
import com.google.gdata.util.ServiceException;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.PostMethod;

import java.util.logging.Logger;

import org.apache.commons.configuration.ConfigurationException;
import sample.appsforyourdomain.AppsForYourDomainClient;


public class UserProvisioner {
    private static final Logger logger = 
        Logger.getLogger(UserProvisioner.class.getName());
    
    private static MigrationConfig migConf = null;
    private AppsForYourDomainClient client = null;
    
    public UserProvisioner() throws ConfigurationException {
        migConf = new MigrationConfig();    
    }
            
    public void createUser(String user, String pwd, String name, String fam, String domain) throws AppsForYourDomainException, 
                                                 ServiceException, 
                                                 IOException, 
                                                 Exception {
        client = new AppsForYourDomainClient(migConf.getGooAdminUser(), migConf.getGooAdminPassword(), domain);
        client.createUser(user, name, fam, pwd);
    }
}
